﻿using System;
using System.Messaging;
using BizUnit;

namespace BTS.Testing.TraceMonitor.BizUnit4.TestSteps
{
    /// <summary>
    /// Starts the event test trace
    /// </summary>
    public class CleanTraceQueue : BizUnit.Xaml.TestStepBase
    {
        public string QueuePath { get; set; }

       
        public override void Execute(Context context)
        {
            if (!MessageQueue.Exists(QueuePath))
                throw new ApplicationException(string.Format("The queue {0} does not exist", QueuePath));

            var queue = new MessageQueue(QueuePath);
            queue.Purge();
        }

        
        public override void Validate(Context context)
        {

        }
    }
}
